package com.gaokao.demo.vo;

import com.gaokao.demo.constants.Constant;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class ResultResponse {

    private Integer code;

    private String message;

    private Object data;

    public static ResultResponse newSuccess(){
        ResultResponse resultResponse = new ResultResponse();
        resultResponse.code= Constant.SUCCESS_CODE;
        resultResponse.message=Constant.SUCCESS;
        return resultResponse;
    }

    public static ResultResponse newSuccess(String message){
        ResultResponse resultResponse = new ResultResponse();
        resultResponse.code= Constant.SUCCESS_CODE;
        resultResponse.message=message;
        return resultResponse;
    }

    public static ResultResponse newSuccess(String message, Object data){
        ResultResponse resultResponse = new ResultResponse();
        resultResponse.code= Constant.SUCCESS_CODE;
        resultResponse.message=message;
        resultResponse.data=data;
        return resultResponse;
    }

    public static ResultResponse newFail(){
        ResultResponse resultResponse = new ResultResponse();
        resultResponse.code= Constant.FAIL_CODE;
        resultResponse.message=Constant.FAIL;
        return resultResponse;
    }

    public static ResultResponse newFail(String message){
        ResultResponse resultResponse = new ResultResponse();
        resultResponse.code= Constant.FAIL_CODE;
        resultResponse.message=message;
        return resultResponse;
    }

    public static ResultResponse newFail(String message, Object data){
        ResultResponse resultResponse = new ResultResponse();
        resultResponse.code= Constant.FAIL_CODE;
        resultResponse.message=message;
        resultResponse.data=data;
        return resultResponse;
    }



}
